<template>
  <div class="notice">
    <el-carousel indicator-position="outside">
      <el-carousel-item v-for="(item, index) in noticeList" :key="index">
        <img :src="item.image_url" alt="" />
        <div class="content">
          {{ item.content }}
        </div>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script>
//导入该"@/api/noval"文件夹下面所有导出
import { getNotice } from "@/api/noval";
export default {
  name: "NoticeIndex",
  components: {},
  props: {},
  data() {
    return { noticeList: [] };
  },
  watch: {},
  computed: {},
  created() {},
  mounted() {
    this.getNotice();
  },
  methods: {
    async getNotice() {
      const { data: res } = await getNotice();
      this.noticeList = res || [];
    },
  },
};
</script>
<style lang="scss" scoped>
.notice {
  width: 100%;
  height: 100%;
  /* background-color: red; */
  .el-carousel__item h3 {
    color: #475669;
    font-size: 18px;
    opacity: 0.75;
    line-height: 300px;
    margin: 0;
  }

  .el-carousel__item:nth-child(2n) {
    background-color: #99a9bf;
  }

  .el-carousel__item:nth-child(2n + 1) {
    background-color: #d3dce6;
  }
  .el-carousel {
    width: 100%;
    height: calc(100% - 30px);
    ::v-deep .el-carousel__container {
      width: 100%;
      height: 96%;
    }
    img {
      display: inline-block;
      width: 100%;
      height: 95%;
    }
    .content {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translateX(-50%, -50%);
      font-size: 20px;
      text-indent: 2em;
      text-align: center;
      color: #ffd04b;
      text-shadow: 2px 2px 2px 2px #475669;
    }
  }
}
</style>
